interface DispatchParams {
  goodsList: KV[];
  selectedGoods: string[];
  currentScreen: string;
  templateId: string;
  image: string;
}
type KV = {
  label: string;
  value: string;
};
// export const goodsList = ref<KV[]>([]);
// export const selectedGoods = ref<string[]>();

export const showDispatch = ref(false);
/* 根据类型不同加载不同模版 */
export const deviceMode = ref<"lcd" | "ink">("ink");
function generateList(num: number): KV {
  const hasValue = dispatchParams.value.goodsList[num];
  return {
    label: String.fromCharCode(96 + num), // 97 是 'a' 的 ASCII 码
    value: hasValue?.value || ""
  };
}
const dispatchParams = ref<DispatchParams>({
  goodsList: [
    {
      label: "a",
      value: ""
    }
  ],
  selectedGoods: [],
  currentScreen: "a",
  templateId: "",
  image: ""
});

export { dispatchParams, generateList };
